﻿using Corina.Datamodel.Base;
using Corina.Datamodel.Interface;
using Corina.Enumerations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Xml.Serialization;

namespace Corina.Datamodel.Entities
{
    [XmlTypeAttribute(Namespace = "http://tempuri.org/")]
    [DataContract]
    public class UserAddressInfo : DatamodelEntity, IUserAddress
    {
        #region Fields
        private int _id;
        private int _userId = 0;
        private string _provinceCode = "01";
        private string _citycode;
        private string _county;
        private string _street;
        private string _postCode;
        #endregion

        #region Properties
        [DataMember]
        public int Id
        {
            get { return _id; }
            set
            {
                _id = value;
                RaisePropertyChanged(() => Id);
            }
        }

        [DataMember]
        public int UserId
        {
            get { return _userId; }
            set
            {
                _userId = value;
                RaisePropertyChanged(() => UserId);
            }
        }

        [DataMember]
        public string ProvinceCode
        {
            get { return _provinceCode; }
            set
            {
                _provinceCode = value;
                RaisePropertyChanged(() => ProvinceCode);
            }
        }

        [DataMember]
        public string CityCode
        {
            get { return _citycode; }
            set
            {
                _citycode = value;
                RaisePropertyChanged(() => CityCode);
            }
        }

        [DataMember]
        public string County
        {
            get { return _county; }
            set
            {
                _county = value;
                RaisePropertyChanged(() => County);
            }
        }

        [DataMember]
        public string Street
        {
            get { return _street; }
            set
            {
                _street = value;
                RaisePropertyChanged(() => Street);
            }
        }

        [DataMember]
        public string PostCode
        {
            get { return _postCode; }
            set
            {
                _postCode = value;
                RaisePropertyChanged(() => PostCode);
            }
        }

        #endregion

        protected override IEnumerable<DatabaseColumn> InitColumns()
        {
            yield return new DatabaseColumn("Id", true);
            yield return new DatabaseColumn("UserId", false, true);
            yield return new DatabaseColumn("ProvinceCode");
            yield return new DatabaseColumn("CityCode");
            yield return new DatabaseColumn("County");
            yield return new DatabaseColumn("Street");
            yield return new DatabaseColumn("PostCode");
        }
    }
}